package com.ljkj.blockpay.util;

import android.content.Context;
import android.content.SharedPreferences;

import com.ljkj.blockpay.basedata.SPApi;

/**
 * Created by yp on 2022/3/10
 */
public class SaveModelToSPUtil {
    private static Context mContext = GlobalContext.getAppContext();
    /**
     * 保存用户的token信息
     */
    public static void saveUserToken(String token) {
        SharedPreferences mySharedPreferences = mContext.getSharedPreferences(SPApi.KEY_SAVE_TOKEN_INFO, Context.MODE_PRIVATE);
        SharedPreferences.Editor edit = mySharedPreferences.edit();
        edit.putString("SPUserToken", token);
        edit.commit();
    }

    /**
     * 获取用户的token信息
     */
    public static String getUserToken() {
        SharedPreferences sharedPreferences = mContext.getSharedPreferences(SPApi.KEY_SAVE_TOKEN_INFO, Context.MODE_PRIVATE);
        String token = sharedPreferences.getString("SPUserToken", "");
        return token;
    }
}
